package com.gitee.shop.domain;

/**
 * 购物项
 */
public class CartItem {
    private Item item;  //商品项
    private int count;  //数量
    private double subtotal;    //小计

    public CartItem() {
    }

    public CartItem(Item item, int count) {
        this.item = item;
        this.count = count;
    }

    public Item getItem() {
        return item;
    }

    public void setItem(Item item) {
        this.item = item;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
    }

    public double getSubtotal() {
        //计算该项的小计
        subtotal = count* item.getShopPrice();
        return subtotal;
    }

    public void setSubtotal(double subtotal) {
        this.subtotal = subtotal;
    }
}
